package ch.sfug.data {

	/**
	 * a simple iterator, that steps over all elements of an xmllist
	 * @author marcel 
	 * adopted loops aray iterator for xml lists
	 */

	public class XmlListLoopIterator extends XmlListIterator {

		public function XmlListLoopIterator( xml:XMLList = null) {
			super(xml);
		}

		
		/**
		 * overrides the super function to reset the iterator when its at the end
		 */
		public override function next(  ):Object {
			if( hasNext() ) {
				return super.next();
			} else {
				super.reset();
				return super.next();
			}
		}

		
		/**
		 * overrides the super function to reset the iterator when its at the start in previous
		 */
		public override function previous(  ):Object {
			if( hasPrevious() ) {
				return super.previous();
			} else {
				super.reset();
				return super.previous();
			}
		}
	}
}